package cn.itheima.dao.impl;

import org.hibernate.Query;
import org.hibernate.Session;

import cn.itheima.dao.Userdao;
import cn.itheima.domain.User;
import cn.itheima.utils.HibernateUtils;

public class UserDaoImpl implements Userdao {

	@Override
	public User login(String user_code) {
		Session  session=HibernateUtils.getCurrentSession();
		String  hql="from  User  where   user_code=?";
		Query  query=session.createQuery(hql);
		query.setParameter(0 , user_code);
		User  u=(User) query.uniqueResult();
		return u;
	}

	

}
